﻿CREATE TABLE [org].[UnitMapping] (
    [UnitMappingId]        INT                 IDENTITY (1, 1) NOT NULL,
    [UnitMappingPath]      [sys].[hierarchyid] NOT NULL,
    [UnitMappingLevel]     AS                  ([UnitMappingPath].[GetLevel]()),
    [UnitHierarchyId]      SMALLINT            NOT NULL,
    [UnitId]               INT                 NOT NULL,
    [UnitMappingStartDate] DATE                NOT NULL,
    [UnitMappingEndDate]   DATE                NULL,
    [UnitMappingInputDate] DATE                NOT NULL,
    PRIMARY KEY CLUSTERED ([UnitMappingId] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF)
);

